import { Component, ViewChild, TemplateRef, ElementRef, OnInit } from '@angular/core';
import { ModalService, ModalTypeEnum } from '@iux/live';

@Component({
  templateUrl: './demo8.component.html'
})
export class Demo8Component implements OnInit {
  @ViewChild('originService', { static: true, read: ElementRef }) originService: ElementRef;
  @ViewChild('contentTpl', { static: false }) contentTpl: TemplateRef<any>;

  constructor(private modalService: ModalService) {}

  ngOnInit() {}

  openService() {
    this.modalService.create({
      lvModalKey: 'myModal',
      lvType: ModalTypeEnum.POPOVER,
      lvHeader: 'Title',
      lvContent: this.contentTpl,
      lvPopoverOrigin: this.originService.nativeElement,
      lvWidth: 400,
      lvAfterClose: res => {
        console.log(res);
      }
    });
  }
}
